<template>
  <div class="container" @click="clickDisappear">
    <div class="wrapper">
      <swiper :options="swiperOption">
        <swiper-slide v-for="(item, index) of list" :key="index">
          <img class="img-box" :src="item" alt="">
        </swiper-slide>
        <div class="swiper-pagination"  slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>
<script> 
export default {
  name: "Gallery",
  props: {
    list: Array,
  },
  data () {
    return {
      swiperOption: {
        pagination : '.swiper-pagination',
        paginationType : 'fraction',
        observer:true,
        observeParents:true,
      }
    }
  },
  methods: {
    clickDisappear () {
      this.$emit('close')
    }
  },
};
</script>
<style scoped>
.container >>> .swiper-container {
  overflow: inherit; 
}
.container {/*页面容器*/
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: fixed;
  left: 0;
  bottom: 0;
  top: 0;
  right: 0;
  background-color: black;
  z-index: 99;
  
}
.wrapper {/*轮播图容器 */
  height: 0;
  width: 100%;
  padding-bottom: 100%;
}
.img-box {
  width: 100%;
}
.swiper-pagination {/*分页器*/
  color: #fff;
  bottom: -1rem;
}
</style>
